import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Form';

import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();

export function getCounterSettingColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.counterSettings.counterId'),
      dataIndex: 'counterID',
      width: 200,
      fixed: 'left',
    },
    {
      title: t('routes.demo.counterSettings.counterRule'),
      dataIndex: 'remark',
      width: 200,
    },
  ];
}

export function getCountSettingForm(): FormSchema[] {
  return [
    {
      field: 'counterID',
      component: 'Input',
      label: t('routes.demo.counterSettings.counterId'),
      required: true,
      componentProps: {
        placeholder: t('routes.demo.counterSettings.counterIdPlaceholder'),
      },
    },
    {
      field: 'remark',
      component: 'Input',
      label: t('routes.demo.counterSettings.counterRule'),
      componentProps: {
        placeholder: t('routes.demo.counterSettings.counterRulePlaceholder'),
      },
    },
  ];
}

export function getCounterSettingModalColumns(): BasicColumn[] {
  return [
    {
      title: t('routes.demo.counterSettings.codeSegmentType'),
      dataIndex: 'tiPDMType',
      width: 200,
      fixed: 'left',
    },
    {
      title: t('routes.demo.counterSettings.codeValue'),
      dataIndex: 'tiPDMValue',
      width: 200,
    },
  ];
}

export function getcodeDefinedForm(): FormSchema[] {
  return [
    {
      field: 'tiPDMType',
      component: 'Select',
      label: t('routes.demo.counterSettings.codeSegmentType'),
      required: true,
      componentProps: {
        placeholder: t('routes.demo.counterSettings.codeSegmentTypePlaceholder'),
        options: [
          { label: t('routes.demo.counterSettings.fixedCodeSegment'), value: '固定码段' },
          { label: t('routes.demo.counterSettings.dateCodeSegment'), value: '日期码段' },
          { label: t('routes.demo.counterSettings.serialCodeSegment'), value: '流水码段' },
        ],
      },
    },
    {
      field: 'tiPDMValue',
      component: 'Input',
      label: t('routes.demo.counterSettings.codeValue'),
      componentProps: {
        placeholder: t('routes.demo.counterSettings.codeValuePlaceholder'),
      },
    },
  ];
}
